#include "stm32f10x.h"                  // Device header
#include "PWM.h"
#include "LED.h"
#include "Servo.h"
void Servo_Init(uint32_t RCC_APB2Periph_GPIO, GPIO_TypeDef* GPIOx, uint16_t pin, GPIOMode_TypeDef mode, uint32_t RCC_APB1Periph, 
	TIM_TypeDef* TIMx, uint16_t TIM_ClockDivision, uint16_t TIM_CounterMode, uint16_t TIM_Period, uint16_t TIM_Prescaler, uint8_t 
	TIM_RepetitionCounter, uint16_t TIM_OCMode, uint16_t TIM_OCPolarity, uint16_t TIM_Pulse, uint8_t Init_Function_Index)
{
	PWM_Init(RCC_APB2Periph_GPIO, GPIOx, pin, mode, RCC_APB1Periph, TIMx, TIM_ClockDivision, TIM_CounterMode, TIM_Period, TIM_Prescaler, 
	TIM_RepetitionCounter, TIM_OCMode, TIM_OCPolarity, TIM_Pulse, Init_Function_Index);
}

void Servo_SetAngle(TIM_TypeDef* TIMx, float angle, uint8_t Duty_Change_Function_Index)
{
	Duty_Change(TIMx, angle * 2000 / 180 + 500, Duty_Change_Function_Index);
}
